package com.spring.boot.quartz.mapper;

import com.spring.boot.quartz.bean.JobAndTriggerBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: springboot_vue
 * @description: 定时任务dao
 * @author: ry
 * @create: 2018-08-16 14:31
 **/
@Repository
@Mapper
public interface JobMapper {

    /**
     * 查询所有定时任务
     * @return
     * @throws Exception
     */
   /* @Select("SELECT QRTZ_JOB_DETAILS.JOB_NAME,QRTZ_JOB_DETAILS.JOB_GROUP,QRTZ_JOB_DETAILS.JOB_CLASS_NAME," +
            "QRTZ_TRIGGERS.TRIGGER_NAME,QRTZ_TRIGGERS.TRIGGER_GROUP,QRTZ_CRON_TRIGGERS.CRON_EXPRESSION," +
            "QRTZ_CRON_TRIGGERS.TIME_ZONE_ID,QRTZ_TRIGGERS.trigger_state FROM QRTZ_JOB_DETAILS JOIN QRTZ_TRIGGERS ON " +
            "QRTZ_JOB_DETAILS.JOB_NAME = QRTZ_TRIGGERS.JOB_NAME  JOIN QRTZ_CRON_TRIGGERS ON " +
            "QRTZ_TRIGGERS.TRIGGER_NAME = QRTZ_CRON_TRIGGERS.TRIGGER_NAME AND " +
            "QRTZ_TRIGGERS.TRIGGER_GROUP = QRTZ_CRON_TRIGGERS.TRIGGER_GROUP")
    @Results({ @Result(property = "job_name", column = "job_name"),
            @Result(property = "job_group", column = "job_group"),
            @Result(property = "job_class_name", column = "job_class_name"),
            @Result(property = "trigger_name", column = "trigger_name"),
            @Result(property = "trigger_group", column = "trigger_group"),
            @Result(property = "cron_expression", column = "cron_expression"),
            @Result(property = "time_zone_id", column = "time_zone_id") ,
            @Result(property = "trigger_state", column = "trigger_state") })*/
          List<JobAndTriggerBean> findAll() throws Exception;
}
